/**
 * Created by liuhe on 2016/12/8.
 */
'use strict';

let mongoose = require('mongoose');
let {dataBaseConfig} = require('../config');
let dburi = dataBaseConfig.uri,
    dbname = dataBaseConfig.dbname,
    dboptions = dataBaseConfig.options;
//数据库地址 
mongoose.Promise = global.Promise;
mongoose.connect(dburi+'/'+dbname,dboptions,(err)=>{
    if (err) return console.error(`连接mongodb(${dburi+'/'+dbname})失败`, err);
    console.info(`连接mongodb(${dburi+'/'+dbname})成功`);
});

module.exports = mongoose;